﻿<Fluent:RibbonWindow x:Class="SGTv2.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Fluent="clr-namespace:Fluent;assembly=Fluent"
    xmlns:s="http://www.stemasoft.com/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:localArbol="clr-namespace:SGTv2.ViewModel"
  Title="Sistema de gestión de movimientos"
   
   
    Background="{Binding Background, ElementName=navigationPaneExpander}" ResizeMode="CanResizeWithGrip" >

    <Fluent:RibbonWindow.Resources>


        <Style x:Key="ClearButan" TargetType="Button">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Border Name="border"
                     Padding="4"
                     Background="transparent">
                            <Grid >
                                <ContentPresenter HorizontalAlignment="Center"
                                    VerticalAlignment="Center">
                                </ContentPresenter>
                            </Grid>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>


        <s:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter1"/>
        <s:BooleanNegateConverter x:Key="BooleanNegateConverter"/>
        <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
    </Fluent:RibbonWindow.Resources>

    <DockPanel LastChildFill="True">
        <Fluent:Ribbon DockPanel.Dock="Top">
            <!--Quick Access Toolbar Items-->
            <Fluent:Ribbon.QuickAccessItems>
                <Fluent:QuickAccessMenuItem Target="{Binding ElementName=buttonGreen}"/>
            </Fluent:Ribbon.QuickAccessItems>

            <!--Tabs-->

            <Fluent:RibbonTabItem Header="Remitos" ReduceOrder="(P),(P),(P),(P),(P)" x:Name="RemitosTab" >
                <Fluent:RibbonGroupBox Header="" HorizontalContentAlignment="Center" HorizontalAlignment="Center">
                    <Fluent:Button LargeIcon="Img\Agregar.png"  Header="Nuevo"  Command="{Binding abrirVentanaRemitoCommand}" />
                </Fluent:RibbonGroupBox>



            </Fluent:RibbonTabItem>

            <Fluent:RibbonTabItem Header="Depositos" >
                <Fluent:RibbonGroupBox x:Name="Depositos_Sel" Header="Deposito actual">
                    <Fluent:Button   Header="Nuevo deposito" Command="{Binding abrirVentanaDepositoCommand}" />
                <Fluent:InRibbonGallery ItemWidth="100" ItemHeight="20" ResizeMode="Both"
                                      MinItemsInRow="1" MaxItemsInRow="1"
                                      ItemsSource="{Binding Depositos}"
                                      SelectedItem="{Binding DepositoActual}"
                                      DisplayMemberPath="Nombre"
                                      GroupBy="Group" Header="Deposito actual">
                </Fluent:InRibbonGallery>
                </Fluent:RibbonGroupBox>
            </Fluent:RibbonTabItem>

            <Fluent:RibbonTabItem Header="Proveedores" >
                <Fluent:RibbonGroupBox x:Name="ABM_Proveedores">
                    <Fluent:Button LargeIcon="/SGT;component/Img/Nuevo.png"  Header="Nuevo proveedor" Command="{Binding AgregarProveedor}" />
                </Fluent:RibbonGroupBox>
            </Fluent:RibbonTabItem>

            <Fluent:RibbonTabItem Header="Mercaderias" >
                <Fluent:RibbonGroupBox x:Name="ABM_Mercaderia">
                    <Fluent:Button LargeIcon="/SGT;component/Img/Arroz.png" Header="Ver mercaderias" />
                    <Fluent:Button LargeIcon="/SGT;component/Img/Nuevo.png"  Header="Nueva mercaderia" Command="{Binding AgregarMercaderia}" />
                    <Fluent:Button LargeIcon="/SGT;component/Img/Editar.png" Header="Editar mercaderia" />

                </Fluent:RibbonGroupBox>

            </Fluent:RibbonTabItem>



            <!--Backstage Items-->
            <Fluent:Ribbon.Menu>
                <Fluent:Backstage>
                    <Fluent:BackstageTabControl>
                        <Fluent:Button Header="Close" Command="{Binding ExitCommand}" Icon="Img\Blue.png"/>
                    </Fluent:BackstageTabControl>
                </Fluent:Backstage>
            </Fluent:Ribbon.Menu>
        </Fluent:Ribbon>
        <Fluent:StatusBar VerticalAlignment="Bottom" DockPanel.Dock="Bottom" />
        <s:NavigationPane x:Name="navigationPane" SelectedIndex="0" LargeItems="4" Margin="0,0,0,0" Width="160">
            
            <s:NavigationPaneItem Header="Remitos"  >
                <StackPanel >
                    <TreeView ItemsSource="{Binding NodosArbol}" Background="{x:Null}" BorderBrush="{x:Null}">
                        <TreeView.ItemContainerStyle>
                            <Style TargetType="{x:Type TreeViewItem}">
                                <Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
                                <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
                                <Setter Property="FontWeight" Value="Normal" />
                                <Style.Triggers>
                                    <Trigger Property="IsSelected" Value="True">
                                        <Setter Property="FontWeight" Value="Bold" />
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </TreeView.ItemContainerStyle>
                        <TreeView.Resources>
                            <HierarchicalDataTemplate 
                              DataType="{x:Type localArbol:ArbolViewModel}" 
                              ItemsSource="{Binding Children}"
                              >
                                <StackPanel Orientation="Horizontal">
                                    <Image Width="16" Height="16" Margin="3,0" Source="{Binding Imagen}"/>
                                    <TextBlock Text="{Binding Name}" />
                                </StackPanel>
                            </HierarchicalDataTemplate>
                        </TreeView.Resources>

                        
                    </TreeView>

                </StackPanel>
            </s:NavigationPaneItem>
            <s:NavigationPaneItem Header="Historial"  >
                <StackPanel >
                    <TreeView ItemsSource="{Binding NodosArbolFecha}" Background="{x:Null}" BorderBrush="{x:Null}">
                        <TreeView.ItemContainerStyle>
                            <Style TargetType="{x:Type TreeViewItem}">
                                <Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
                                <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
                                <Setter Property="FontWeight" Value="Normal" />
                                <Style.Triggers>
                                    <Trigger Property="IsSelected" Value="True">
                                        <Setter Property="FontWeight" Value="Bold" />
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </TreeView.ItemContainerStyle>
                        <TreeView.Resources>
                            <HierarchicalDataTemplate 
                              DataType="{x:Type localArbol:ArbolViewModel}" 
                              ItemsSource="{Binding Children}"
                              >
                                <StackPanel Orientation="Horizontal">
                                    <Image Width="16" Height="16" Margin="3,0" Source="{Binding Imagen}"/>
                                    <TextBlock Text="{Binding Name}" />
                                </StackPanel>
                            </HierarchicalDataTemplate>
                        </TreeView.Resources>


                    </TreeView>

                </StackPanel>
            </s:NavigationPaneItem>
        </s:NavigationPane>
        <s:NavigationPaneExpander x:Name="navigationPaneExpander" Orientation="Right" CloseButtonClick="navigationPaneExpander_CloseButtonClick" DockPanel.Dock="Right" Margin="0,0,2,1" Width="200" >
            <s:NavigationPaneExpander.Header>
                <TextBlock Foreground="Red" Text="aaaaa"/>
            </s:NavigationPaneExpander.Header>
            <Grid x:Name="CanResizeContent" s:NavigationPaneExpander.CanResize="False" >
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <ScrollViewer ScrollViewer.VerticalScrollBarVisibility="Auto" >
                    <Calendar />
                </ScrollViewer>


            </Grid>
        </s:NavigationPaneExpander>
        <Frame  x:Name="frameContenido" NavigationUIVisibility="Hidden" Source="{Binding ContenidoPagina}" IsManipulationEnabled="True" />
    </DockPanel>
</Fluent:RibbonWindow>
